﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.PopulationUI {
    import flash.events.*;
    import flash.display.*;
    import flash.geom.*;
    import Engine.Helpers.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import Classes.util.*;
    import com.greensock.*;
    import Display.*;
    import Display.aswingui.*;
    import com.greensock.easing.*;

    public class PopulationPopup extends NotifyPopup {

        protected static var m_instance:PopulationPopup;

        protected var m_bShowing:Boolean = false;
        protected var m_state:int;
        private var m_removeTimer:Timer;

        public function PopulationPopup(_arg1:Function=null){
            super(_arg1);
            this.m_removeTimer = new Timer(1000, 1);
        }
        public static function getInstance():PopulationPopup{
            if (!m_instance){
                m_instance = new (PopulationPopup)();
            };
            return (m_instance);
        }

        public function get showing():Boolean{
            return (this.m_bShowing);
        }
        override protected function onAssetsLoaded(_arg1:Event=null):void{
            m_jpanel = this.createDialogView(this.createAssetDict());
            m_appearPos = new Vector2(38, (472 - 150));
            ASwingHelper.prepare(m_jpanel);
            this.x = m_appearPos.x;
            this.y = m_appearPos.y;
            finalizeAndShow();
            Global.ui.bottomUI.addChild(this);
        }
        override protected function loadAssets():void{
            Global.delayedAssets.get(DelayedAssetLoader.POPULATION_ASSETS, makeAssets);
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Dictionary = new Dictionary();
            _local1["bgAsset"] = (new m_comObject.neighborBar_populationPopup() as DisplayObject);
            return (_local1);
        }
        override protected function onShow():void{
            super.onShow();
            this.mouseEnabled = (this.mouseChildren = false);
        }
        override public function show():void{
            m_appearPos = new Vector2(36, (472 - 147));
            if (Global.isVisiting()){
                m_appearPos.y = (m_appearPos.y + 25);
            };
            this.x = m_appearPos.x;
            this.y = m_appearPos.y;
            if (m_jpanel){
                (m_jpanel as NotifyPopupView).rebuild(NotifyPopupView.STATE_LONG);
                ASwingHelper.prepare(m_jwindow);
                super.show();
                stopDisappearTimer();
            };
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            return (new PopulationPopupView(_arg1, m_message, m_title, m_type, m_callback, this));
        }
        override protected function showTween():void{
            var startSize:* = null;
            var matParams:* = null;
            var mat:* = null;
            this.m_bShowing = true;
            this.mouseEnabled = (this.mouseChildren = false);
            startSize = new Point(m_content.width, m_content.height);
            matParams = {scale:0.3};
            if (m_centered){
                centerPopup();
            };
            mat = new Matrix();
            mat.translate((-(startSize.x) / 2), (-(startSize.y) / 2));
            mat.scale(matParams.scale, matParams.scale);
            mat.translate((startSize.x / 2), (startSize.y / 2));
            m_content.transform.matrix = mat;
            TweenLite.to(matParams, TWEEN_TIME, {
                scale:1,
                ease:Back.easeOut,
                onUpdate:function ():void{
                    mat = new Matrix();
                    mat.translate((-(startSize.x) / 2), (-(startSize.y) / 2));
                    mat.scale(matParams.scale, matParams.scale);
                    mat.translate((startSize.x / 2), (startSize.y / 2));
                    m_content.transform.matrix = mat;
                    this.visible = true;
                },
                onComplete:function ():void{
                    m_bShowing = false;
                    onShowComplete();
                }
            });
        }

    }
}//package Display.PopulationUI 
